home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / smaltalk / st80_pr4.lha / st80_pre4 / MoDE / EventTest-Shan.st < prev    next >
Text File  |  1993-07-24  |  18KB  |  647 lines

  1. SharedQueue subclass: #EventQueue
  2.     instanceVariableNames: 'last putBack '
  3.     classVariableNames: 'Limit '
  4.     poolDictionaries: ''
  5.     category: 'EventTest-Shan'!
  6.  
  7.  
  8. !EventQueue methodsFor: 'private'!
  9.  
  10. makeRoomAtEnd
  11.     "Don't let the contentsArray grow if the size is going to be larger 
  12.     than the Limit.  Instead throw away the events at front and write 
  13.     to Transcript for warning."
  14.     "December 10, 1988 Shan"
  15.  
  16.     | contentsSize |
  17.     "^super makeRoomAtEnd"
  18.     readPosition = 1
  19.         ifTrue: [contentsArray size < Limit
  20.                 ifTrue: [contentsArray grow. ^false]
  21.                 ifFalse: 
  22.                     [Transcript show: 'Event queue overflow\' withCRs.
  23.                     readPosition _ 1.
  24.                     writePosition _ 1.
  25.                     readSynch initSignals. ^true
  26.                     ]]
  27.         ifFalse: 
  28.             [contentsSize _ writePosition - readPosition.
  29.             1 to: contentsSize do: [:index | contentsArray at: index put: (contentsArray at: index + readPosition - 1)].
  30.             readPosition _ 1.
  31.             writePosition _ contentsSize + 1. ^false]! !
  32.  
  33. !EventQueue methodsFor: 'access'!
  34.  
  35. lastUpdatedCopy
  36.     "Returns the most recently arrieved event with the attributes    
  37.     updated.  Shan July 14, 1989"
  38.  
  39.     | e |
  40.     last isNil ifTrue: [last _ MMSEvent new].  "Shan 25 May 1990"
  41.     e _ last copy.
  42.     "Store the previous point in extent for use of Enter/Leave events."
  43.     e previousOrigin: e origin.
  44.     "e origin: Sensor primMousePt.
  45.     ^e setButtonStatus  Shan 13 July 1990"
  46.     ^ e!
  47.  
  48. next
  49.     "Inplement the put back function. When putBack is not nil. The event 
  50.     pointed by putBack should be treated as the first event in the 
  51.     queue. Shan 25 May 1990"
  52.  
  53.     | temp |
  54.     putBack isNil
  55.         ifTrue: [^super next]
  56.         ifFalse: 
  57.             [temp _ putBack.
  58.             putBack _ nil.
  59.             ^temp]!
  60.  
  61. nextPut: value 
  62.     "Handle the overflow case. Shan September 29, 1989"
  63.  
  64.     | overflow |
  65.     overflow _ false.
  66.     accessProtect critical: [contents size > Limit
  67.             ifTrue: 
  68.                 ["contents _ OrderedCollection new."
  69.                 "Transcript show: 'Event queue overflow\' withCRs"
  70.                 overflow _ true.    "Shan 11 June 1990"
  71.                 self init: contents size]
  72.             ifFalse: [contents addLast: value]].
  73.     last _ value deepCopy.
  74.     overflow ifFalse: [readSynch signal].
  75.     ^value!
  76.  
  77. nextWithCursorMoveCompressed
  78.     "This is a message for tracing the cursor.  If there are more than one  
  79.     contineous cursorMove events in the queue, only the last one is  
  80.     returned.  Shan April 25, 1989"
  81.     "Compress the events" 
  82.  
  83.     | event |
  84.     [self size > 1]
  85.         whileTrue: 
  86.             [event _ self next.
  87.             event selector == #cursorMove ifFalse: [^event]].
  88.     ^self next!
  89.  
  90. peek
  91.     "Return an event if there is one in the queue. Otherwise, return nil. 
  92.     The event is not removed from the queue. Shan 1 July 1990"
  93.  
  94.     putBack isNil
  95.         ifTrue: [^super peek]
  96.         ifFalse: [^putBack]!
  97.  
  98. putBack: e 
  99.     "Push back one event. This is only one level deep. Be VERY CAREFUL 
  100.     when using this method. It may break the eventQ. Shan 25 May 
  101.     1990"
  102.  
  103.     putBack _ e!
  104.  
  105. size
  106.     "Shan 16 July 1990"
  107.  
  108.     putBack isNil
  109.         ifTrue: [^super size]
  110.         ifFalse: [^super size + 1]! !
  111.  
  112. !EventQueue methodsFor: 'control'!
  113.  
  114. disable
  115.     "Ask the current InputState to stop generating events and flush self.  This 
  116.     way, there will be no event supply and the processes which read 
  117.     from EventQ will be blocked."
  118.  
  119.     InputState1 suspendGeneratingEvents.
  120.     self flush!
  121.  
  122. enable
  123.     InputState1 resumeGeneratingEvents!
  124.  
  125. flush
  126.     "Flushe the eventQ.  All previous events are lost."
  127.     "Shan March 12, 1989"
  128.  
  129.     self init: Limit! !
  130.  
  131. !EventQueue methodsFor: 'mouse'!
  132.  
  133. cursorPoint: aPoint 
  134.     "Shan August 6, 1989"
  135.  
  136.     | e |
  137.     Sensor cursorPoint: aPoint.
  138.     "self nextPut: (self lastUpdatedCopy selector: #cursorMove)."
  139.     "Change back for replay.  Shan 8 July 1990"
  140.     last isNil ifTrue: [last _ MMSEvent new].    "Shan 25 May 1990"
  141.     e _ last copy.    "Store the previous point in extent for use of Enter/Leave events."
  142.     e previousOrigin: e origin.
  143.     e origin: aPoint.
  144.     self nextPut: (e selector: #cursorMove)!
  145.  
  146. leftButtonDown
  147.     "Shan 19 July 1990"
  148.  
  149.     ^last leftButtonDown!
  150.  
  151. middleButtonDown
  152.     "Shan 19 July 1990"
  153.  
  154.     ^last middleButtonDown!
  155.  
  156. mousePoint
  157.     "'Sensor mousePoint' is not used for the purpose of replay. When 
  158.     replaying a transcript, the cursorPosition will have no relationship at 
  159.     all with the position of the recorded cursorPosition. Shan August 4, 
  160.     1989"
  161.     "^last origin"
  162.     "This cause some problem when polling application is involved. The 
  163.     last event only reflect the last mouse point before the cursor enters 
  164.     a polling application.  This problem came up when I tried to create a
  165.     hypertext link from the polling text editor. This also help the dragging 
  166.     offset problem.Use the Sensor for the time being. Shan 25 May 1990"
  167.  
  168.     "^Sensor mousePoint"
  169.     "Bring back the old one.  Now I have an event-driven text editor. 
  170.     Shan  8 July 1990"
  171.     ^last origin!
  172.  
  173. rightButtonDown
  174.     "Shan 19 July 1990"
  175.  
  176.     ^last rightButtonDown!
  177.  
  178. waitButton
  179.     "Wait for the user to press any mouse button and then answer with 
  180.     the current location of the cursor.  Shan March 23, 1989"
  181.  
  182.     | event selector |
  183.     
  184.     [event _ self next.
  185.     selector _ event selector.
  186.     selector = #leftButtonDown | (selector = #rightButtonDown) | (selector = #middleButtonDown)] whileFalse.
  187.     ^event origin!
  188.  
  189. waitClickButton
  190.     "Wait for the user to click (press and then release) any mouse button and then
  191.     answer with the current location of the cursor.  Shan March 23, 1989"
  192.  
  193.     self waitButton.
  194.     ^self waitNoButton!
  195.  
  196. waitNoButton
  197.     "Wait for the user to release any mouse button and then answer with 
  198.     the current location of the cursor.  Shan August 22, 1989"
  199.  
  200.     | event selector  |
  201.     
  202.     "self lastUpdatedCopy anyButtonDown ifFalse: [^last origin]." "Shan April 24, 1990"
  203.     last anyButtonDown ifFalse: [^last origin]. "Shan 13 July 1990"
  204.     [event _ self next.
  205.     selector _ event selector.
  206.     selector = #leftButtonUp | (selector = #rightButtonUp) | (selector = #middleButtonUp)] whileFalse.
  207.     ^event origin! !
  208. "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
  209.  
  210. EventQueue class
  211.     instanceVariableNames: ''!
  212.  
  213.  
  214. !EventQueue class methodsFor: 'initialize'!
  215.  
  216. initialize
  217.     Limit _ 100.
  218.     Smalltalk at: #EventQ put: (EventQueue new: Limit)! !
  219.  
  220. !EventQueue class methodsFor: 'event handling tests'!
  221.  
  222. buttonTest
  223.     "
  224. Smalltalk at: #Consumer put: nil.
  225. EventQ inspect.
  226. Consumer inspect.
  227.  
  228.  
  229. EventQueue initialize.
  230. Consumer terminate.
  231.  
  232.     | ee | Consumer _ [ [1=1] whileTrue: [ee _ EventQ next.
  233.     Transcript show: ee selector printString.
  234.     ee free] ] newProcess.
  235. Consumer resume.
  236.  
  237. Consumer suspend.
  238.  
  239.     "!
  240.  
  241. queueTest
  242.     "
  243. Smalltalk at: #Consumer put: nil.
  244. EventQ inspect.
  245. Consumer inspect.
  246.  
  247.  
  248. EventQueue initialize.
  249. Consumer terminate.
  250.  
  251.     | ee | Consumer _ [ [1=1] whileTrue: [ee _ EventQ next.
  252.     Transcript show: ee origin x printString.
  253.     ee free] ] newProcess.
  254. Consumer resume.
  255.  
  256.  
  257.     | e | 13 timesRepeat: [e _ MMSEvent new. 
  258.     Processor yield.
  259.     e origin: Sensor mousePoint.
  260.     EventQ nextPut: e].
  261.  
  262.  
  263.  
  264. Consumer suspend.
  265.  
  266.     "! !
  267.  
  268. EventQueue initialize!
  269.  
  270.  
  271. Object subclass: #MMSEvent
  272.     instanceVariableNames: 'origin previousOrigin msec buttonStatus keyboardEvent selector enterLeaveUsed data '
  273.     classVariableNames: ''
  274.     poolDictionaries: ''
  275.     category: 'EventTest-Shan'!
  276. MMSEvent comment:
  277. 'The following is a list of event selectors.  Shan November 30, 1989
  278.  
  279. 1.    cursorMove
  280.  
  281. 2.    leftButtonDown
  282.     middleButtonDown
  283.     rightButtonDown
  284.  
  285. 3.    leftButtonUp
  286.     middleButtonUp
  287.     rightButtonUp
  288.  
  289. 4.    leftButtonDoubleClick
  290.     middleButtonDoubleClick
  291.     rightButtonDoubleClick
  292.  
  293. 5.    keyboardEvent'!
  294.  
  295.  
  296. !MMSEvent methodsFor: 'mouse buttons'!
  297.  
  298. anyButtonDown
  299.     "Shan August 1, 1989"
  300.  
  301.     ^buttonStatus > 0!
  302.  
  303. leftButtonDown
  304.     ^(buttonStatus bitAnd: 4) ~= 0!
  305.  
  306. middleButtonDown
  307.     ^(buttonStatus bitAnd: 2) ~= 0!
  308.  
  309. rightButtonDown
  310.     ^(buttonStatus bitAnd: 1) ~= 0! !
  311.  
  312. !MMSEvent methodsFor: 'access'!
  313.  
  314. buttonStatus
  315.     "Shan August 1, 1989"
  316.  
  317.     ^buttonStatus!
  318.  
  319. buttonStatus: int
  320.     "Shan August 1, 1989"
  321.  
  322.     buttonStatus _ int!
  323.  
  324. data
  325.     "Shan July 20, 1989"
  326.  
  327.     ^ data!
  328.  
  329. data: anObj 
  330.     "data can be anything.   Shan July 20, 1989"
  331.  
  332.     data _ anObj!
  333.  
  334. keyboardEvent
  335.     ^keyboardEvent!
  336.  
  337. keyboardEvent: aKeyboardEvent
  338.     keyboardEvent _aKeyboardEvent!
  339.  
  340. msec
  341.     "Shan February 12, 1990"
  342.  
  343.     ^msec!
  344.  
  345. msec: int
  346.     msec _ int!
  347.  
  348. origin
  349.     ^origin!
  350.  
  351. origin: aPoint
  352.     origin _aPoint!
  353.  
  354. previousOrigin
  355.     ^previousOrigin!
  356.  
  357. previousOrigin: aPoint
  358.     previousOrigin _aPoint!
  359.  
  360. selector
  361.     ^selector!
  362.  
  363. selector: aSel
  364.     selector _ aSel! !
  365.  
  366. !MMSEvent methodsFor: 'initialize'!
  367.  
  368. initialize
  369.     origin _ Sensor mousePoint.
  370.     "The above statement is to prevent the first event after the 'EventQ 
  371.     disable/enable to contain the wrong mouse point.  Some times, the 
  372.     mouse point is immediately queried after 'EventQ enable'.  See 
  373.     FixedImageLibObj>sizeByText.  Shan September 6, 1989"
  374.     previousOrigin _ 0 @ 0.
  375.     msec _ 0.
  376.     buttonStatus _ 0.
  377.     selector _ 0.
  378.     enterLeaveUsed _ false! !
  379.  
  380. !MMSEvent methodsFor: 'free'!
  381.  
  382. free
  383.     self nilFields.! !
  384.  
  385. !MMSEvent methodsFor: 'private'!
  386.  
  387. enterLeaveUsed
  388.     "This is strictly private for the event dispatching mechanism to 
  389.     process the enterLeave event.  No other use allowed.  It serves two 
  390.     purposes.  First for the correct process of the enterLeave events.  
  391.     Second to optimize the computation of the process.  Shan April 11, 
  392.     1989 "
  393.  
  394.     ^enterLeaveUsed!
  395.  
  396. enterLeaveUsed: aBool 
  397.     "This is strictly private for the event dispatching mechanism to   
  398.     process the enterLeave event.  No other use allowed.  When 
  399.     enterLeaveUsed is true.  The modes should not use this cursorMove 
  400.     event to generate any enterLeave events.  A cursorMove event is 
  401.     marked used after the first (topmost) mode has used it to process 
  402.     the enterLeave events.  Shan April 11, 1989"
  403.  
  404.     enterLeaveUsed _ aBool! !
  405. "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
  406.  
  407. MMSEvent class
  408.     instanceVariableNames: ''!
  409.  
  410.  
  411. !MMSEvent class methodsFor: 'instance creation'!
  412.  
  413. new
  414.     ^super new initialize! !
  415.  
  416. InputState subclass: #InputState1
  417.     instanceVariableNames: ''
  418.     classVariableNames: 'ClosestLBtDownTime ClosestMBtDownTime ClosestRBtDownTime CursorTracingProcess GeneratingEvents SecondClosestLBtDownTime SecondClosestMBtDownTime SecondClosestRBtDownTime '
  419.     poolDictionaries: ''
  420.     category: 'EventTest-Shan'!
  421. InputState1 comment:
  422. 'I am to replace the InputState class.  The main purpose of me is to generate events'!
  423.  
  424.  
  425. !InputState1 methodsFor: 'Event Generation'!
  426.  
  427. buttonDown: param 
  428.     "Process only mouse button events."
  429.     "Dcember 11, 1988  Shan"
  430.     "Also set the time that the button is down."
  431.     "Shan March 16, 1989"
  432.     "Add in 'setButtonStatus' message here.  It is tricky.  May not be 
  433.     consistent, but better than before.  The 'buttonUp:' method is not 
  434.     changed.  More experiment needed to justify this.  Shan May 15, 
  435.     1989 "
  436.  
  437.     | event |
  438.     GeneratingEvents
  439.         ifTrue: 
  440.             [event _ EventQ lastUpdatedCopy.
  441.             event buttonStatus: Sensor buttons.  "Shan 13 July 1990"
  442.             param = 130
  443.                 ifTrue: 
  444.                     [event selector: #leftButtonDown.
  445.                     EventQ nextPut: event.
  446.                     SecondClosestLBtDownTime _ ClosestLBtDownTime.
  447.                     ClosestLBtDownTime _ Time millisecondClockValue]
  448.                 ifFalse: [param = 129
  449.                         ifTrue: 
  450.                             [event selector: #middleButtonDown.
  451.                             EventQ nextPut: event.
  452.                             SecondClosestMBtDownTime _ ClosestMBtDownTime.
  453.                             ClosestMBtDownTime _ Time millisecondClockValue]
  454.                         ifFalse: [param = 128
  455.                                 ifTrue: 
  456.                                     [event selector: #rightButtonDown.
  457.                                     EventQ nextPut: event.
  458.                                     SecondClosestRBtDownTime _ ClosestRBtDownTime.
  459.                                     ClosestRBtDownTime _ Time millisecondClockValue]]]]!
  460.  
  461. buttonUp: param 
  462.     "Process only mouse button events."
  463.     "Dcember 11, 1988  Shan"
  464.     "Also generate the double click events."
  465.     "Shan March 16, 1989"
  466.  
  467.     | event |
  468.     GeneratingEvents
  469.         ifTrue: 
  470.             [event _ EventQ lastUpdatedCopy.
  471.             event buttonStatus: Sensor buttons.  "Shan 13 July 1990"
  472.             param = 130
  473.                 ifTrue: 
  474.                     [event selector: #leftButtonUp.
  475.                     EventQ nextPut: event.
  476.                     Time millisecondClockValue - SecondClosestLBtDownTime < 1000
  477.                         ifTrue: 
  478.                             [event _ EventQ lastUpdatedCopy. 
  479.                             event selector: #leftButtonDoubleClick.
  480.                             EventQ nextPut: event.
  481.                             ClosestLBtDownTime _ 0.
  482.                             SecondClosestLBtDownTime _ 0]]
  483.                 ifFalse: [param = 129
  484.                         ifTrue: 
  485.                             [event selector: #middleButtonUp.
  486.                             EventQ nextPut: event.
  487.                             Time millisecondClockValue - SecondClosestMBtDownTime < 1000
  488.                                 ifTrue: 
  489.                                     [event _ EventQ lastUpdatedCopy.
  490.                                     event selector: #middleButtonDoubleClick.
  491.                                     EventQ nextPut: event.
  492.                                     ClosestMBtDownTime _ 0.
  493.                                     SecondClosestMBtDownTime _ 0]]
  494.                         ifFalse: [param = 128
  495.                                 ifTrue: 
  496.                                     [event selector: #rightButtonUp.
  497.                                     EventQ nextPut: event.
  498.                                     Time millisecondClockValue - SecondClosestRBtDownTime < 1000
  499.                                         ifTrue: 
  500.                                             [event _ EventQ lastUpdatedCopy.
  501.                                             event selector: #rightButtonDoubleClick.
  502.                                             EventQ nextPut: event.
  503.                                             ClosestRBtDownTime _ 0.
  504.                                             SecondClosestRBtDownTime _ 0]]]]]!
  505.  
  506. cursorMove
  507.     | event |
  508.     GeneratingEvents
  509.         ifTrue: 
  510.             [event _ EventQ lastUpdatedCopy.
  511.             event origin: Sensor primMousePt. "Shan 13 July 1990"
  512.             event origin = event previousOrigin ifTrue: [
  513.                 "This is for the keyboard events. Smalltalk generates a 
  514.                 redundant cursorMove event before each key stroke 
  515.                 event. This is to eliminate that. Shan 3 July 1990"
  516.                 ^self].    "Store the previous point in extent for use of Enter/Leave 
  517.             events."
  518.             event enterLeaveUsed: false.
  519.             event buttonStatus: Sensor buttons. "Shan 15 July 1990"
  520.             event selector: #cursorMove.
  521.             EventQ nextPut: event]!
  522.  
  523. generateKeyboardEvent: aKeyboardEvent upDown: int 
  524.     "aKeyboardEvent is a Smalltalk KeyboardEvent.  Package it to be a   
  525.     MMSEvent."
  526.     "Shan March 11, 1989"
  527.  
  528.     | event |
  529.     event _ EventQ lastUpdatedCopy.
  530.     event keyboardEvent: aKeyboardEvent.
  531.     int = 1
  532.         ifTrue: [event selector: #keyboardEvent]
  533.         ifFalse: ["This will never be generated because the keyboardUp event 
  534.             in Smalltalk VM comes in pair with the keyboardDown event 
  535.             event the user is holding the key down.  There is no point 
  536.             supporting this event.  Shan June 7, 1989"
  537.             event selector: #keyboardUp].
  538.     ^EventQ nextPut: event! !
  539.  
  540. !InputState1 methodsFor: 'private'!
  541.  
  542. keyAt: keyNumber put: value
  543.     | index mask keyboardEvent |
  544.     index _ keyNumber bitAnd: 255. "Get rid of meta bits"
  545.     (index < BitMin or: [index > OtherMeta3])
  546.       ifTrue:  "Not a potential special character"
  547.         [value = 1 ifTrue: "only look at down strokes"
  548.             [index = InterruptKey
  549.                 ifTrue: [(lshiftState ~= 0 or: [(keyNumber bitAnd: 16r100) ~= 0])
  550.                             ifTrue: [self forkEmergencyEvaluatorAt: Processor userInterruptPriority]
  551.                             ifFalse: [[ScheduledControllers interruptName: 'User Interrupt'] fork]]
  552.                 ifFalse: [index = EmergencyInterruptKey
  553.                             ifTrue: [self forkEmergencyEvaluatorAt: Processor userInterruptPriority]
  554.                             ifFalse: [keyboardEvent _(KeyboardEvent
  555.                                                             code: index
  556.                                                             meta: (metaState bitOr: (keyNumber bitShift: -8))).
  557. GeneratingEvents ifFalse: [^keyboardQueue nextPut: keyboardEvent]
  558. ifTrue:[^self generateKeyboardEvent: keyboardEvent upDown: value]. ]]]]
  559.       ifFalse: [self setStateFor: index with: value.
  560.             metaState _ (((((ctrlState bitOr: (lshiftState bitOr: rshiftState)) bitOr: lockState) bitOr: metaKeyState)
  561.                                 bitOr: otherMetaKey1State) bitOr: otherMetaKey2State) bitOr: otherMetaKey3State]!
  562.  
  563. run
  564.     "This is the loop that actually processes input events.  Shan September 29, 1989"
  565.  
  566.     | word type param |
  567.     [true]
  568.         whileTrue: 
  569.             [InputSemaphore wait. 
  570.             "Test for mouse X/Y events here to avoid an activation."
  571.             word _ self primInputWord.
  572.             type _ word bitShift: -12.
  573.             param _ word bitAnd: 4095.  "Transcript show: type printString."
  574. "Mouse X"    type = 1 ifTrue: [x _ param]
  575. "Mouse Y"    ifFalse: [type = 2 ifTrue: [y _ param. self cursorMove.]
  576. "Key down"    ifFalse: [type = 3 ifTrue: [self keyAt: param put: 1. self buttonDown: param]
  577. "Key up"    ifFalse: [type = 4 ifTrue: [self keyAt: param put: 0. self buttonUp: param]
  578. "MetaInput"ifFalse: [type = 7 ifTrue: [self metaInput: word]
  579. "Delta time"ifFalse: [type = 0 ifTrue: []
  580. "Reset time"ifFalse: [type = 5 ifTrue: [self primInputWord; primInputWord]
  581.             ifFalse: [self error: 'Bad event type']]]]]]]]! !
  582. "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
  583.  
  584. InputState1 class
  585.     instanceVariableNames: ''!
  586.  
  587.  
  588. !InputState1 class methodsFor: 'event generation control'!
  589.  
  590. resumeGeneratingEvents
  591.     GeneratingEvents _ true!
  592.  
  593. suspendGeneratingEvents
  594.     GeneratingEvents _ false! !
  595.  
  596. !InputState1 class methodsFor: 'initialize'!
  597.  
  598. initialize
  599.     "The CursorTracingProcess is a temperary hack due to the Smalltalk   
  600.     2.3 cursorMove event compression.  It should be removed when the   
  601.     interpreter goes as specified in the document.  The   
  602.     'primSampleInterval:' method in InputState class is also tried but no   
  603.     good."
  604.     "CursorTracingProcess terminate. CursorTracingProcess _ nil. InputState1 initialize"
  605.     "March 11, 1989  Shan"
  606.  
  607.     | p p1 event delay |
  608.     self replaceSystemInputState. "Shan 5 August 1990"
  609.     "Setups for the generation of double click events."
  610.     "Shan March 16, 1989"
  611.     ClosestLBtDownTime _ 0.
  612.     SecondClosestLBtDownTime _0.
  613.     ClosestMBtDownTime _ 0.
  614.     SecondClosestMBtDownTime _0.
  615.     ClosestRBtDownTime _ 0.
  616.     SecondClosestRBtDownTime _0.
  617.     GeneratingEvents _ false.
  618.     (Smalltalk version = 'Smalltalk-80, Version 2.3 of 13 June 1988' and: [CursorTracingProcess == nil])
  619.         ifTrue: 
  620.             ["This is version 2.3"
  621.             delay _ (Delay forMilliseconds: 100).
  622.             CursorTracingProcess _ [[true]
  623.                         whileTrue: 
  624.                             [p _ Sensor mousePoint.
  625.                             (GeneratingEvents and: [p ~= p1])
  626.                                 ifTrue: 
  627.                                     [event _ EventQ lastUpdatedCopy.
  628.                                     event selector: #cursorMove.
  629.                                     EventQ nextPut: event.
  630.                                     p1 _ p].
  631.                              delay wait]] newProcess.
  632.             CursorTracingProcess priority: Processor lowIOPriority.
  633.             "When we can make sure the supends and resumes paired up,   
  634.                this should be controlled by the same mechanism that      
  635.             controls the GeneratingEvents.  The process should not      
  636.             running all the time."
  637.             CursorTracingProcess resume]! !
  638.  
  639. !InputState1 class methodsFor: 'become real'!
  640.  
  641. replaceSystemInputState
  642.     "InputState1 replaceSystemInputState"
  643.  
  644.     InputSensor install! !
  645.  
  646. InputState1 initialize!
  647.